/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.me.stepapp.persistence;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class LocationChangeReceiver  extends BroadcastReceiver{
    // Display an alert that we've received a message.

   LocationDBInterface act = null;

    public LocationChangeReceiver( ) {
    }

    public LocationChangeReceiver( LocationDBInterface lact ){
        act = lact;
    }

    @Override
    public void onReceive(Context context, Intent intent){
	    // Send a text notification to the screen.
        String sender=  intent.getStringExtra("sender");
        String message=  intent.getStringExtra("message");

        String msg="";
        if ( act==null ){
            msg = msg+" null ";
        } else {
            msg = msg+" LOCATION ADDED!!! ";
        }

        msg = msg + "message from " + sender +" is " + message;
        if ( act != null) {
            act.onUpdateLocations();
        }
        Toast.makeText(context,msg, Toast.LENGTH_SHORT).show();
    }
}